package ch.fhnw.qualiscan.core.libraries;

import java.io.Serializable;

import com.vaadin.ui.Window.Notification;

import eu.livotov.tpt.TPTApplication;

/**
 * This library takes care of all the notifications displayed.
 * @author Benjamin Groehbiel
 *
 */
public class NotificationLib implements Serializable {
	
	/**
	 * Displays a success notification on application level.
	 * @param message String you would like to display.
	 */
	public static void showSuccess(String title, String message) {
		TPTApplication.getCurrentApplication().getMainWindow().showNotification(title, message, Notification.TYPE_HUMANIZED_MESSAGE);
	}
	
	/**
	 * Displays a Warning notification on application level.
	 * @param message String you would like to display.
	 */
	public static void showWarning(String title, String message) {
		TPTApplication.getCurrentApplication().getMainWindow().getWindow().showNotification(title, message, Notification.TYPE_WARNING_MESSAGE);
	}
	
	/**
	 * Displays a error notification on application level.
	 * @param message String you would like to display.
	 */
	public static void showError(String title, String message) {
		TPTApplication.getCurrentApplication().getMainWindow().showNotification(title, message, Notification.TYPE_ERROR_MESSAGE);
	}
	
	/**
	 * Displays a tray message on application level, e.g. used for reminders.
	 * @param message String you would like to display.
	 */
	public static void showTrayMessage(String title, String message) {
		TPTApplication.getCurrentApplication().getMainWindow().showNotification(title, message, Notification.TYPE_TRAY_NOTIFICATION);
	}
	
}
